package com.tdx.tnv.magicads;

import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup.LayoutParams;
import android.widget.TextView;

public class MainActivity extends FragmentActivity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		final MagicAds ads = MagicAds.newInstance(MagicAds.ADS_SEX);
		findViewById(R.id.button1).setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View arg0) {
				if (ads.isReady()) {
					TextView view = new TextView(MainActivity.this);
					view.setLayoutParams(new LayoutParams(
							android.widget.LinearLayout.LayoutParams.MATCH_PARENT,
							android.widget.LinearLayout.LayoutParams.MATCH_PARENT));
					view.setText("DAY LA QUANG CAO");
					ads.setViewTop(view);

					ads.show(getSupportFragmentManager(), "dialog");
				}
			}
		});
	}

}
